 <script>

  $(document).ready(function() {
       $("#offer_valid_from").datepicker();
	  

	 $('#offer_valid_from').datepicker('option', {dateFormat:'yy-mm-dd'});
	 $("#offer_valid_to").datepicker();
	  

	 $('#offer_valid_to').datepicker('option', {dateFormat:'yy-mm-dd'});
	 


  });
  </script>
  <script type="text/javascript" src="/extra/fckeditor/fckeditor.js"></script>
<?php
//echo $this->adminToolBar('hotdeals', 'add', '/admin/hotdeals/add/', '/admin/hotdeals/edit/', '/admin/hotdeals/delete/', '/admin/hotdeals/index/');
?>
<form action="/admin/hotdeals/doaddhotdeals/" method="post" enctype="multipart/form-data" id="hotdeals_frm" name="hotdeals_frm">
<table border="1" width="100%" cellpadding="1" cellspacing="2">
	<tr>
		<td width="15%">Hotdeal Title</td>
		<td width="85%"><input type="text" name="title" id="title" value="" class="input-2" /></td>
	</tr>	
	<tr>
		<td>Hotdeal Description</td>
		<td><textarea name="description" id="description" rows="5" cols="80" class="input-txtarea"></textarea></td>
	</tr>
	<tr>
		<td>Valid from</td>
		<td><input name="offer_valid_from" value="" class="input-calendar"  id="offer_valid_from"/></td>
	</tr>
	<tr>
		<td>Valid to</td>
		<td><input name="offer_valid_to" value="" class="input-calendar"  id="offer_valid_to"  type="text" /></td>
	</tr>
	<tr>
		<td width="15%">Default image</td>
		<td width="85%"><div class="input-2"><input type="file" name="default_image[]" size="80" id="default_image"/></div> </td>
	</tr>	
	<tr>
		<td>Status</td>
		<td>
			<select name="status" id="status" class="input-2">
				<option value="">Select Status</option>
				<option value="1">Published</option>
				<option value="0">Unpublished</option>
			</select>
		</td>
	</tr>
        <tr>
            <td colspan="2"><input type="submit" value="save" name="submit" onclick="updatehotdeals(this.form)"></td>
        </tr>
</table>
</form>
  <script type="text/javascript">
    function updatehotdeals(frm){
        //var page_id = document.getElementById("page_id").value;

        var title = $("#title");
        var description = $("#description");
        var offer_valid_from = $("#offer_valid_from");
        var offer_valid_to = $("#offer_valid_to");
        var default_image = $("#default_image");
        var status = $("#status");  

        if(title.val() == "") {
                alert("Page title is required and cannot be blank");
                title.focus();
                return false;	
        } else if(description.val() == "") {
                alert("Descrition is required and cannot be blank");
                title.focus();
                return false;	
        } else if(offer_valid_from.val() == "") {
                alert("Valid from is required and cannot be blank");
                title.focus();
                return false;	
        } else if(offer_valid_to.val() == "") {
                alert("Valid to is required and cannot be blank");
                title.focus();
                return false;	
        } else if(default_image.val() == "") {
                alert("Default image is required and cannot be blank");
                title.focus();
                return false;	
        } else if(status.val() == "") {
                alert("Status is required and cannot be blank");
                status.focus();
                return false;	
        } else {
            //$('#hotdeals_frm').submit();
            document.forms["hotdeals_frm"].submit();        
        }	
    }
  </script>